package test6.publics;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.Select;

import test6.pages.SearchPage;

public class SearchUser {
	public static void search(WebDriver driver,String dxp,String axp,String ddata,String adata,String no) {
		driver.switchTo().defaultContent();//退回到主界面
		driver.switchTo().frame("body");
		driver.switchTo().frame("navbar");
		
		SearchPage.search_01(driver).click();
		driver.switchTo().defaultContent();//退回到主界面
		//driver.switchTo().parentFrame();           //返回到上一个frame层
		driver.switchTo().frame("body");
		driver.switchTo().frame(driver.findElement(By.name("info")));
		
		
		SearchPage.search_DepartureCity(driver).click();//出发城市设置
	    new Select(driver.findElement(By.name("depart"))).selectByVisibleText("Denver");
	    driver.findElement(By.xpath(dxp)).click();
	    
	    SearchPage.search_ArrivalCity(driver).click();//到达城市设置
	    new Select(driver.findElement(By.name("arrive"))).selectByVisibleText("Denver");
	    driver.findElement(By.xpath(axp)).click();
	    
	    SearchPage.search_departDate(driver).clear();//设置出发时间
	    SearchPage.search_departDate(driver).sendKeys(ddata);
	    
	    SearchPage.search_returnDate(driver).clear();//设置到达时间
	    SearchPage.search_returnDate(driver).sendKeys(adata);
	    
	    SearchPage.search_nb(driver).clear();//人数设置
	    SearchPage.search_nb(driver).sendKeys(no);
	    
	    SearchPage.search_submit(driver).click();//确认  
	    
	    SearchPage.search_list3(driver).click();
		SearchPage.search_reserveFlights(driver).click();;
		
		SearchPage.search_buyFlights(driver).click();//支付
	}
	

}
